package com.ly.chatsimple.ui.chat.usecase

import com.ly.chatsimple.tcp.Response
import com.ly.chatsimple.tcp.TcpClient
import com.ly.data.FuncProto
import com.ly.data.FuncProto.ClientList
import com.ly.data.MessageProtobuf.Req

class GetClientInfoUseCase {

    suspend operator fun invoke(): Response<ClientList> {
        return TcpClient.request(
            Req.newBuilder()
                .setMethod(FuncProto.Func.GetClientsInfo)
                .build()
        ) {
            ClientList.parseFrom(it)
        }
    }
}